<template>
	<view class="body">
		<view class="Box" style="background-color: #fff;">
			<u-cell-group :border=false>
				<u-cell icon="https://v-shop.shuzp.top/v2/assets/img/icon_status_1.a231969c.png"
					:title="orderInfo.statusStr" :isLink="true" value="订单跟踪" titleStyle="font-weight:800"
					@click="show=true">

				</u-cell>
				<u-cell icon="map" :border=false :title="'收货人:'+logistics.linkMan" titleStyle="font-weight:800"
					:value="logistics.mobile" :label="'收货地址:'+address" :isLink="false"></u-cell>
			</u-cell-group>
			<view class="bgc">
			</view>
			<view class="btm">
				<text>物流信息</text>
				<text>无</text>
			</view>
		</view>
		<!-- 商品列表 -->
		<view class="shoplist">
			<u-cell-group :border=false>
				<u-cell icon="bag" title="商品列表" titleStyle="font-weight:800"></u-cell>

			</u-cell-group>
			<view class="smallbox" v-for="item in orderdetail" :key="item.id">
				<view class="img">
					<image :src="item.pic"></image>
				</view>
				<view class="content">
					<view class="title_content">
						{{item.goodsName}}
					</view>
					<view class="detail_content">

					</view>
					<view class="price_content">
						<text style="color: green; font-size: 30rpx;">￥{{item.amountSingle}}</text>
						<text style="color: #969799;">×{{item.number}}</text>
					</view>
				</view>
			</view>


			<view class="totalprice">
				<text>商品小计:</text>
				<text style="color: green; "> ￥{{total}}</text>
			</view>
		</view>

		<!-- 留言 -->
		<view class=" message">
			<text style="color: #969799;">买家留言</text>
			<text>无</text>
		</view>
		<u-gap height="20" bgColor="rgb(247,248,250)"></u-gap>
		<!-- 商品金额 运费 -->
		<view class="shopPrice_Box">
			<view>
				<text style="color: #969799;">商品金额</text>
				<text>￥{{total}}</text>
			</view>
			<view>
				<text style="color: #969799;">运费</text>
				<text>+{{traprice}}.00</text>
			</view>
		</view>
		<view class="Actualpayment">
			<text>实付款:</text>
			<text style="color: green; ">￥{{total}}</text>
		</view>
		<u-gap height="20" bgColor="rgb(247,248,250)"></u-gap>
		<!-- 订单跟踪 -->
		<view class="OrderTracking">
			<view>
				<u-row style="height: 60rpx; ">
					<u-col span="1.5" style="text-align: right;"><text>订单编号:</text></u-col>
					<u-col span="3.5"><text>{{orderInfo.orderNumber}}</text></u-col>
					<u-col span="1"><u-tooltip text="复制" copyText="230317152316050006" overlay showCopy style="background-color: #fff; border-radius: 20rpx; border:1rpx solid #ccc;justify-content: center;"></u-tooltip></u-col>
				</u-row>
				<u-row style="height: 60rpx; ">
					<u-col span="1.5" style="text-align:right;"><text>下单时间:</text></u-col>
					<u-col span="3.5" style="text-align:left;"><text>{{orderInfo.datePay}}</text></u-col>

				</u-row>
				<u-row style="height: 60rpx; ">
					<u-col span="1.5" style="text-align: right;"><text>支付方式:</text></u-col>
					<u-col span="2"><text>在线支付</text></u-col>

				</u-row>
				<u-row style="height: 60rpx; ">
					<u-col span="1.5" style="text-align: right;"><text>付款方式:</text></u-col>
					<u-col span="2"><text>钱包余额</text></u-col>

				</u-row>
				<u-row style="height: 60rpx; ">
					<u-col span="1.5" style="text-align: right;"><text>配送方式:</text></u-col>
					<u-col span="2"><text>普通快递</text></u-col>

				</u-row>
			</view>
		</view>
		<u-gap height="20" bgColor="rgb(247,248,250)"></u-gap>
		<view style="height:80rpx; line-height: 80rpx;display: flex;align-items: center; justify-content: flex-end;">
			<u-row>
				<u-col>
					<u-toast ref="uToast"></u-toast>
					<u-button style="outline: none;" icon="server-fill" shape="circle" text="联系客服"
						@click="showToast(list)"></u-button>
				</u-col>
			</u-row>

		</view>
		<u-popup :show="show" mode="bottom" :round="10" @close="close" @open="open">
			<view>
				<h1 style="text-align: center; padding: 20rpx;">订单跟踪</h1>
				<view style="padding: 20rpx;">
					<view style="border-bottom:1rpx solid #ccc ;">
						<view>下单</view>
						<view>{{orderInfo.dateAdd}}</view>
					</view>
					<view style="border-bottom:1rpx solid #ccc;">
						<view>支付</view>
						<view>{{orderInfo.datePay}}</view>
					</view>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import {
		_orderdetail
	} from "../../api/orderdetail.js"
	export default {
		data() {
			return {
				
				show: false,
				list: {
					message: "此功能尚未开放",
				},
				id: "",
				orderInfo: {},
				orderdetail: [],
				logistics: {},
				address: '',
				total: null,
				traprice: null
			}
		},

		methods: {
			showToast(params) {
				this.$refs.uToast.show({
					...params
				})
			},
			open() {
				// console.log('open');
			},
			close() {
				this.show = false
				// console.log('close');
			},

			getorderdetail() {
				_orderdetail({
					id: this.id
				}).then(res => {
					console.log(res, 4444)
					if (res.code === 0) {
						this.orderdetail = res.data.goods
						this.orderInfo = res.data.orderInfo
						this.logistics = res.data.logistics
						this.address = this.logistics.provinceStr + this.logistics.cityStr + this.logistics.areaStr
						console.log(this.goodsMap)

						res.data.goods.forEach(item => {

							this.total += item.number * item.amountSingle
							this.traprice += item.amountCoupon

						})

					}
				})
			}
		},
		onReady() {
			this.getorderdetail()
		},
		onLoad(option) {
			this.id = option.id

		}
	}
</script>

<style lang="scss" scoped>
	.body {
		height: 100vh;
		background-color: rgb(247, 248, 250);

	}

	.Box {
		background-color: #fff !important;
	}

	.btm {
		display: flex;
		justify-content: space-between;
		padding: 2% 6%;
	}

	.bgc {
		background-image: url("../../static/bgc.png");
		height: 5rpx;
		background-size: 100rpx 100%;
		width: 100%;

	}

	.shoplist {
		background-color: #fff;
		margin: 5% 0;


		.totalprice {
			height: 60rpx;
			line-height: 60rpx;
			padding-right: 20rpx;
			text-align: right;
		}

		.smallbox {
			display: flex;
			height: 180rpx;


			.img {
				box-sizing: border-box;
				flex-basis: 40%;
				padding: 2% 5%;


				image {
					width: 150rpx;
					height: 150rpx;

					border-radius: 20rpx;
					vertical-align: top;
				}
			}

			.content {

				flex-basis: 60%;
				display: flex;
				flex-direction: column;
				justify-content: space-around;

				title_content {
					flex-basis: 30%;
				}

				.detail_content {
					flex-basis: 60%;
				}

				.price_content {
					flex-basis: 10%;
					display: flex;
					padding: 0 20rpx 10rpx 5rpx;
					justify-content: space-between;
					align-items: center;
				}
			}
		}
	}

	.message {
		height: 60rpx;
		display: flex;
		justify-content: space-between;
		padding: 0 20rpx;
		align-items: center;
		background-color: #fff;
	}

	.shopPrice_Box>view {
		background-color: #fff;
		display: flex;
		height: 80rpx;
		justify-content: space-between;
		align-items: center;
		padding: 0 20rpx;
	}

	.Actualpayment {
		height: 80rpx;
		text-align: right;
		line-height: 80rpx;
		padding: 0 20rpx;
	}
</style>
